<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Jedrzej\Pimpable\PimpableTrait;

class SystemGroupData extends Model
{
    use HasFactory;
    use PimpableTrait;

    public $searchable = [
        'status',
    ];

    public $fillable = [
        'group_id',
        'value',
        'sort',
        'status'
    ];

    public $casts = [
        'value' => 'array',
    ];

    protected $defaultSortCriteria = ['sort,desc'];

    /**
     * 组合数据详情所属数据组
     */
    public function systemGroup()
    {
        return $this->belongsTo(SystemGroup::class, 'group_id','id');
    }
}
